package com.weishu.system.service.impl;

import com.weishu.common.core.utils.DateUtils;
import com.weishu.common.core.web.domain.AjaxResult;
import com.weishu.system.domain.TbBusiness;
import com.weishu.system.mapper.TbBusinessMapper;
import com.weishu.system.service.ITbBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 商户Service业务层处理
 *
 * @author weishu
 * @date 2021-11-15
 */
@Service
public class TbBusinessServiceImpl implements ITbBusinessService
{
    @Autowired
    private TbBusinessMapper tbBusinessMapper;

    /**
     * 查询商户
     *
     * @param id 商户ID
     * @return 商户
     */
    @Override
    public TbBusiness selectTbBusinessById(Long id)
    {
        return tbBusinessMapper.selectTbBusinessById(id);
    }

    /**
     * 查询商户列表
     *
     * @param tbBusiness 商户
     * @return 商户
     */
    @Override
    public java.util.List<TbBusiness> selectTbBusinessList(TbBusiness tbBusiness)
    {
        return tbBusinessMapper.selectTbBusinessList(tbBusiness);
    }

    /**
     * 新增商户
     *
     * @param tbBusiness 商户
     * @return 结果
     */
    @Override
    public int insertTbBusiness(TbBusiness tbBusiness)
    {
        tbBusiness.setCreateTime(DateUtils.getNowDate());
        return tbBusinessMapper.insertTbBusiness(tbBusiness);
    }

    /**
     * 修改商户
     *
     * @param tbBusiness 商户
     * @return 结果
     */
    @Override
    public AjaxResult updateTbBusiness(TbBusiness tbBusiness)
    {

        return AjaxResult.success(tbBusinessMapper.updateTbBusiness(tbBusiness));
    }

    /**
     * 批量删除商户
     *
     * @param ids 需要删除的商户ID
     * @return 结果
     */
    @Override
    public int deleteTbBusinessByIds(Long[] ids)
    {
        return tbBusinessMapper.deleteTbBusinessByIds(ids);
    }

    /**
     * 删除商户信息
     *
     * @param id 商户ID
     * @return 结果
     */
    @Override
    public int deleteTbBusinessById(Long id)
    {
        return tbBusinessMapper.deleteTbBusinessById(id);
    }
}
